package com.xbongbong.saas.script.tempenum;

import com.alibaba.fastjson.JSONArray;
import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.paas.enums.ComboTypeEnum;
import com.xbongbong.paas.enums.DateTimeEnum;
import com.xbongbong.paas.enums.DefaultTypeEnum;
import com.xbongbong.paas.enums.DefaultValueEnum;
import com.xbongbong.paas.enums.FieldTypeEnum;
import com.xbongbong.paas.help.FormDataFormExplainHelper;
import com.xbongbong.paas.field.DefaultAttrPoJo;
import com.xbongbong.paas.field.FieldAttrEntity;
import com.xbongbong.paas.field.ItemPoJo;
import com.xbongbong.paas.field.LinkDetailPojo;
import com.xbongbong.paas.field.SubFormPoJo;
import com.xbongbong.paas.field.TuningPoJo;
import com.xbongbong.pro.constant.I18nStringConstant;
import com.xbongbong.pro.enums.SaasMarkEnum;
import com.xbongbong.paas.field.SaasParticularAttributePoJo;
import com.xbongbong.saas.constant.BasicConstant;
import com.xbongbong.saas.constant.StringConstant;
import com.xbongbong.saas.enums.PhoneExtEnum;
import com.xbongbong.saas.enums.RedundantTemplateTypeEnum;
import com.xbongbong.saas.enums.ShowTypeEnum;
import com.xbongbong.saas.enums.XbbRefTypeEnum;
import com.xbongbong.saas.enums.business.CustomerManagementEnum;
import com.xbongbong.saas.enums.dictionary.ArchivedEnum;
import com.xbongbong.saas.enums.dictionary.CustomerGenreEnum;
import com.xbongbong.saas.enums.dictionary.CustomerIndividualEnum;
import com.xbongbong.saas.enums.dictionary.CustomerIndustryEnum;
import com.xbongbong.saas.enums.dictionary.CustomerScaleEnum;
import com.xbongbong.saas.enums.dictionary.CustomerSourceEnum;
import com.xbongbong.saas.enums.dictionary.CustomerWastageEnum;
import com.xbongbong.saas.enums.dictionary.PublicEnum;
import com.xbongbong.saas.enums.dictionary.SexEnum;
import com.xbongbong.saas.script.help.InitExplainsHelper;
import com.xbongbong.sys.enums.RoleEnum;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * TempCustomerManagementEnum
 *
 * @author GuoJun.HU
 * @since V1.0
 * @date 2019/2/19 11:07
 */
@Getter
public enum TempCustomerManagementEnum {
    //
    BASE_INFO(CustomerManagementEnum.BASE_INFO),
    SCORE(CustomerManagementEnum.SCORE),
    NAME(CustomerManagementEnum.NAME),
    CLUE_ID(CustomerManagementEnum.CLUE_ID),
    NAME_SHORT(CustomerManagementEnum.NAME_SHORT),
    PHONE(CustomerManagementEnum.PHONE),
    ADDRESS(CustomerManagementEnum.ADDRESS),
    TYPE(CustomerManagementEnum.TYPE),
    CUSTOMER_STAGE(CustomerManagementEnum.CUSTOMER_STAGE),
    WASTAGE(CustomerManagementEnum.WASTAGE),
    WASTAGE_MEMO(CustomerManagementEnum.WASTAGE_MEMO),
    OWNER_ID(CustomerManagementEnum.OWNER_ID),
    COUSERID(CustomerManagementEnum.COUSERID),
    SEX(CustomerManagementEnum.SEX),
    BIRTHDAY(CustomerManagementEnum.BIRTHDAY),
    QQ(CustomerManagementEnum.QQ),
    WE_CHRT(CustomerManagementEnum.WE_CHRT),
    ASSOCIATED_INFO(CustomerManagementEnum.ASSOCIATED_INFO),
    ADD_CONTACT(CustomerManagementEnum.ADD_CONTACT),
    EXTEND_INFO(CustomerManagementEnum.EXTEND_INFO),
    GENRE(CustomerManagementEnum.GENRE),
    LABEL(CustomerManagementEnum.LABEL),
    IS_INDIVIDUAL(CustomerManagementEnum.IS_INDIVIDUAL),
    SCALE(CustomerManagementEnum.SCALE),
    INDUSTRY(CustomerManagementEnum.INDUSTRY),
    IMPORTANT_DEGREE(CustomerManagementEnum.IMPORTANT_DEGREE),
    SOURCE(CustomerManagementEnum.SOURCE),
    WEBSITE(CustomerManagementEnum.WEBSITE),
    INSTRUCTION(CustomerManagementEnum.INSTRUCTION),
    COUNTRY(CustomerManagementEnum.COUNTRY),
    HOBBIES(CustomerManagementEnum.HOBBIES),
    IMAGE(CustomerManagementEnum.IMAGE),
    FILE(CustomerManagementEnum.FILE),
    MEMO(CustomerManagementEnum.MEMO),
    SYSTEM_INFO(CustomerManagementEnum.SYSTEM_INFO),
    CREATOR(CustomerManagementEnum.CREATOR),
    ADD_TIME(CustomerManagementEnum.ADD_TIME),
    UPDATE_TIME(CustomerManagementEnum.UPDATE_TIME),
    CONTACT_NAME(CustomerManagementEnum.CONTACT_NAME),
    CONTACT_PHONE(CustomerManagementEnum.CONTACT_PHONE),
    PARENT(CustomerManagementEnum.PARENT),
    LAST_CONNECT_TIME(CustomerManagementEnum.LAST_CONNECT_TIME),
    BACK_PUBLIC_DATE(CustomerManagementEnum.BACK_PUBLIC_DATE),
    DISTRIBUTION_DATE(CustomerManagementEnum.DISTRIBUTION_DATE),
    BIRTHDAY_FLAG(CustomerManagementEnum.BIRTHDAY_FLAG),
    BIRTHDAY_MMDD(CustomerManagementEnum.BIRTHDAY_MMDD),
    IS_PUBLIC(CustomerManagementEnum.IS_PUBLIC),
    IS_ARCHIVED(CustomerManagementEnum.IS_ARCHIVED),
    DD_CUSTOMER_ID(CustomerManagementEnum.DD_CUSTOMER_ID),
    PARENT_HIDE(CustomerManagementEnum.PARENT_HIDE),
    CREATOR_ID(CustomerManagementEnum.CREATOR_ID),
    CLUE_COMPANY_ID(CustomerManagementEnum.CLUE_COMPANY_ID),
    RECEIVABLE_PERIOD(CustomerManagementEnum.RECEIVABLE_PERIOD),
    CLUE_ID_NAME(CustomerManagementEnum.CLUE_NAME_ID),
    STAGE_PROCESS_ID(CustomerManagementEnum.STAGE_PROCESS_ID),
    STAGE_ID(CustomerManagementEnum.STAGE_ID),
    STAGE_RATIO(CustomerManagementEnum.STAGE_RATIO),
    BACK_NUM(CustomerManagementEnum.BACK_NUM),
    PUBLIC_GROUP(CustomerManagementEnum.PUBLIC_GROUP),
    CONTRACT_SIGN_DATE(CustomerManagementEnum.CONTRACT_SIGN_DATE),
    OPPORTUNITY_ADD_DATE(CustomerManagementEnum.OPPORTUNITY_ADD_DATE),
    ;

    private CustomerManagementEnum anEnum;

    TempCustomerManagementEnum(CustomerManagementEnum anEnum) {
        this.anEnum = anEnum;
    }

    public static List<TempCustomerManagementEnum> getAllEnum() {
        List<TempCustomerManagementEnum> list = new ArrayList<>();
        Collections.addAll(list, values());
        return list;
    }

    public static void initBackNum(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setIsOpen(0);
        fieldAttrEntity.setAccuracy(0);
        fieldAttrEntity.setEditable(0);
        fieldAttrEntity.setShowEditable(0);
        fieldAttrEntity.setUnableEditMemo(I18nMessageUtil.getMessage(StringConstant.AUTO_GEN_FIELD));
    }

    public static void initPublicGroup(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setIsOpen(0);
        fieldAttrEntity.setIsForbidden(0);
        fieldAttrEntity.setEditable(0);
        fieldAttrEntity.setShowEditable(0);
        fieldAttrEntity.setUnableEditMemo(I18nMessageUtil.getMessage(StringConstant.AUTO_GEN_FIELD));
    }

    public static void initStageProcessId(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setIsRedundant(0);
    }

    public static void initStageId(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setIsRedundant(0);
    }

    public static void initStageRatio(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setIsRedundant(0);
        fieldAttrEntity.setIsOpen(0);
        fieldAttrEntity.setShowEditable(0);
        fieldAttrEntity.setEditable(0);
        fieldAttrEntity.setAccuracy(0);
    }

    public static void initName(FieldAttrEntity fieldAttrEntity) {
        LinkDetailPojo linkDetailPojo = new LinkDetailPojo();
        linkDetailPojo.setBusinessType(XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode());
        linkDetailPojo.setSubBuisenssType(XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode());
        linkDetailPojo.setSaasMark(SaasMarkEnum.SAAS.getCode());
        linkDetailPojo.setAttr(NAME.getAnEnum().getAttr());
        fieldAttrEntity.setLinkDetail(linkDetailPojo);
        fieldAttrEntity.setNoRepeat(1);
        fieldAttrEntity.setIsForbidden(0);
    }

    public static void initGenre(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setItems(InitExplainsHelper.setCombItemByEnum(CustomerGenreEnum.class, fieldAttrEntity.getFieldType()));
        fieldAttrEntity.setDictionaryFlag(1);
    }

    public static void initType(FieldAttrEntity fieldAttrEntity) {
//        String str = "潜在客户,初步接触,持续跟进,成交客户,忠诚客户,无效客户";
        fieldAttrEntity.setItems(new ArrayList<>());
        fieldAttrEntity.setComboType(ComboTypeEnum.CUSTOM.getType());
        fieldAttrEntity.setDictionaryFlag(0);
    }

    /**
     * 初始化性别
     *
     * @param fieldAttrEntity 字段解释实体
     */
    public static void initSex(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setItems(InitExplainsHelper.setCombItemByEnum(SexEnum.class, fieldAttrEntity.getFieldType()));
        fieldAttrEntity.setDictionaryFlag(1);
    }


    public static void initIsIndividual(FieldAttrEntity fieldAttrEntity) {
//        String str = "企业客户,个人客户,政府事业单位";
        fieldAttrEntity.setItems(InitExplainsHelper.setCombItemByEnum(CustomerIndividualEnum.class, fieldAttrEntity.getFieldType()));
        fieldAttrEntity.setDictionaryFlag(1);
    }

    public static void initScale(FieldAttrEntity fieldAttrEntity) {
//        String str = "小型,中型,大型";
        fieldAttrEntity.setItems(InitExplainsHelper.setCombItemByEnum(CustomerScaleEnum.class, fieldAttrEntity.getFieldType()));
        fieldAttrEntity.setDictionaryFlag(1);
    }

    public static void initIndustry(FieldAttrEntity fieldAttrEntity) {
//        String str = "金融,电信,教育,高科技,政府,制造业,服务业,能源,零售,媒体,娱乐,咨询,非营利事业,公用事业,其他";
        fieldAttrEntity.setItems(InitExplainsHelper.setCombItemByEnum(CustomerIndustryEnum.class, fieldAttrEntity.getFieldType()));
        fieldAttrEntity.setDictionaryFlag(1);
    }

    public static void initCountry(FieldAttrEntity fieldAttrEntity) {
        String str = "中国,美国,澳大利亚,巴西,英国,加拿大,日本,德国,希腊,瑞士,新西兰,意大利";
        fieldAttrEntity.setItems(InitExplainsHelper.setCombItem(str));
        fieldAttrEntity.setDictionaryFlag(1);
    }

    public static void initSource(FieldAttrEntity fieldAttrEntity) {
//        String str = "网络推广,电话销售,渠道代理";
        fieldAttrEntity.setItems(InitExplainsHelper.setCombItemByEnum(CustomerSourceEnum.class, fieldAttrEntity.getFieldType()));
        fieldAttrEntity.setDictionaryFlag(1);
    }

    public static void initIsPublic(FieldAttrEntity fieldAttrEntity) {
//        String str = "公海客户,非公海客户";
        fieldAttrEntity.setItems(InitExplainsHelper.setCombItemByEnum(PublicEnum.class, fieldAttrEntity.getFieldType()));
    }

    public static void initIsArchived(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setItems(InitExplainsHelper.setCombItemByEnum(ArchivedEnum.class, fieldAttrEntity.getFieldType()));
    }

    public static void initLastConnectTime(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setRecentTime(true);
        fieldAttrEntity.setDateType(DateTimeEnum.DATETIME.getType());
        fieldAttrEntity.setEditable(0);
        fieldAttrEntity.setUnableEditMemo(I18nMessageUtil.getMessage(StringConstant.AUTO_GEN_FIELD));
    }

    public static void initBackPublicDate(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setDateType(DateTimeEnum.DATETIME.getType());
    }

    public static void initAddress(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setDateType("");
        fieldAttrEntity.setShowDetailAddress(1);
    }

    public static void initWastage(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setItems(InitExplainsHelper.setCombItemByEnum(CustomerWastageEnum.class, fieldAttrEntity.getFieldType()));
    }

    /**
     * 初始化添加联系人
     *
     * @param fieldAttrEntity 字段
     * @author feng.zheng
     * @return void
     * @date 2019/2/20 19:06
     */
    public static void initAddContact(FieldAttrEntity fieldAttrEntity) {
        SaasParticularAttributePoJo saasParticularAttributePoJo = new SaasParticularAttributePoJo();
        saasParticularAttributePoJo.setLinkBusinessType(XbbRefTypeEnum.CONTACT.getCode());
        fieldAttrEntity.setSaasParticularAttributePoJo(saasParticularAttributePoJo);
    }

    public static void initPhone(FieldAttrEntity fieldAttrEntity) {
        SubFormPoJo subFormPoJo = new SubFormPoJo();
        List<FieldAttrEntity> items = new ArrayList<>();
        FieldAttrEntity type = InitExplainsHelper.setField("text_1", "类型", "type", FieldTypeEnum.COMBO.getType(), 4, ShowTypeEnum.ALL.getCode(), 0, 1);
//        String str = "工作,手机,住址,主要,传真,其他";
        List<ItemPoJo> itemPoJoList = InitExplainsHelper.setCombItemByEnum(PhoneExtEnum.class, FieldTypeEnum.COMBO.getType());
        itemPoJoList.get(0).setChecked(true);
        type.setItems(itemPoJoList);
        type.setRequired(1);
        type.setDictionaryFlag(1);
        type.setParentAttr(PHONE.anEnum.getAttr());
        items.add(type);
        FieldAttrEntity phone = InitExplainsHelper.setField("text_2", "电话", "phone", FieldTypeEnum.TEXT.getType(), 4, ShowTypeEnum.ALL.getCode(), 0, 1);
        phone.setNoRepeat(1);
        phone.setParentAttr(PHONE.anEnum.getAttr());
        phone.setRequired(1);
        items.add(phone);
        subFormPoJo.setItems(items);
        fieldAttrEntity.setSubForm(subFormPoJo);
        DefaultAttrPoJo defaultAttrPoJo = new DefaultAttrPoJo();
        defaultAttrPoJo.setDefaultType(DefaultTypeEnum.CUSTOM.getAlias());
        fieldAttrEntity.setDefaultAttr(defaultAttrPoJo);
        fieldAttrEntity.setRequired(1);
        fieldAttrEntity.setDictionaryFlag(1);
        // 客户电话子表单允许开关
        fieldAttrEntity.setIsForbidden(1);
    }

    public static void initPhone(FieldAttrEntity fieldAttrEntity, JSONArray phoneArray) {
        SubFormPoJo subFormPoJo = new SubFormPoJo();
        List<FieldAttrEntity> items = new ArrayList<>();
        if (phoneArray.contains("subForm_1.text_1")) {
            FieldAttrEntity type = InitExplainsHelper.setField("text_1", "类型", "type", FieldTypeEnum.COMBO.getType(), 4, ShowTypeEnum.ALL.getCode(), 0, 1);
            List<ItemPoJo> itemPoJoList = InitExplainsHelper.setCombItemByEnum(PhoneExtEnum.class, FieldTypeEnum.COMBO.getType());
            itemPoJoList.get(0).setChecked(true);
            type.setItems(itemPoJoList);
            type.setRequired(1);
            type.setDictionaryFlag(1);
            type.setParentAttr(PHONE.anEnum.getAttr());
            items.add(type);
        }
        if (phoneArray.contains("subForm_1.text_2")) {
            FieldAttrEntity phone = InitExplainsHelper.setField("text_2", "电话", "phone", FieldTypeEnum.TEXT.getType(), 4, ShowTypeEnum.ALL.getCode(), 0, 1);
            phone.setNoRepeat(1);
            phone.setParentAttr(PHONE.anEnum.getAttr());
            phone.setRequired(1);
            items.add(phone);
        }
        subFormPoJo.setItems(items);
        fieldAttrEntity.setSubForm(subFormPoJo);
        DefaultAttrPoJo defaultAttrPoJo = new DefaultAttrPoJo();
        defaultAttrPoJo.setDefaultType(DefaultTypeEnum.CUSTOM.getAlias());
        fieldAttrEntity.setDefaultAttr(defaultAttrPoJo);
        fieldAttrEntity.setRequired(1);
        fieldAttrEntity.setDictionaryFlag(1);
        fieldAttrEntity.setIsForbidden(0);
    }

    public static void initContactPhone(FieldAttrEntity fieldAttrEntity) {
        SubFormPoJo subFormPoJo = new SubFormPoJo();
        List<FieldAttrEntity> items = new ArrayList<>();
        FieldAttrEntity item = InitExplainsHelper.setField("text_1", "类型", "type", FieldTypeEnum.COMBO.getType(), 4, 1, 0, 1);
        //        String str = "工作,手机,住址,主要,传真,其他";
        item.setItems(InitExplainsHelper.setCombItemByEnum(PhoneExtEnum.class, fieldAttrEntity.getFieldType()));
        item.setRequired(1);
        item.setDictionaryFlag(1);
        item.setParentAttr(CONTACT_PHONE.anEnum.getAttr());
        items.add(item);
        FieldAttrEntity item2 = InitExplainsHelper.setField("text_2", "电话", "phone", FieldTypeEnum.TEXT.getType(), 4, 1, 0, 1);
        item2.setNoRepeat(1);
        item2.setParentAttr(CONTACT_PHONE.anEnum.getAttr());
        items.add(item2);
        subFormPoJo.setItems(items);
        fieldAttrEntity.setSubForm(subFormPoJo);
    }

    public static void initLocation(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setLocationCenterFlag(0);
        fieldAttrEntity.setLocationCenter(new ArrayList<>());
        fieldAttrEntity.setAppShowType(0);
        TuningPoJo tuningPoJo = new TuningPoJo();
        tuningPoJo.setEnable(0);
        tuningPoJo.setRadius(500);
        fieldAttrEntity.setTuning(tuningPoJo);
    }

    /**
     * 初始化生日
     *
     * @param fieldAttrEntity 实体
     * @author feng.zheng
     * @date 2019/2/14 15:53
     */
    public static void initBirthday(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setLinkedText(BIRTHDAY_FLAG.anEnum.getAttr());
        fieldAttrEntity.setDateType(DateTimeEnum.TIME.getType());
    }

    public static void initParent(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setLinkedType(RedundantTemplateTypeEnum.CUSTOMER.getCode());
        fieldAttrEntity.setLinkedText(PARENT_HIDE.getAnEnum().getAttr());
        SaasParticularAttributePoJo saasParticularAttributePoJo = new SaasParticularAttributePoJo();
        saasParticularAttributePoJo.setMultiCheck(false);
        saasParticularAttributePoJo.setRelyMode("customer");
        saasParticularAttributePoJo.setRelyType("base");
        fieldAttrEntity.setSaasParticularAttributePoJo(saasParticularAttributePoJo);
    }

    public static void initClueId(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setIsOpen(0);
        fieldAttrEntity.setLinkedType(RedundantTemplateTypeEnum.CLUE.getCode());
        fieldAttrEntity.setLinkedText(CLUE_ID_NAME.getAnEnum().getAttr());
        SaasParticularAttributePoJo saasParticularAttributePoJo = new SaasParticularAttributePoJo();
        saasParticularAttributePoJo.setMultiCheck(false);
        saasParticularAttributePoJo.setRelyMode("customer");
        saasParticularAttributePoJo.setRelyType("base");
        fieldAttrEntity.setSaasParticularAttributePoJo(saasParticularAttributePoJo);
    }

    public static void initCoUserId(FieldAttrEntity fieldAttrEntity) {
        //可新增权限：超级管理员、老板、销售主管、创建人、负责人、负责人主管
        fieldAttrEntity.setShowEditable(0);
        fieldAttrEntity.setAdd(1);
        fieldAttrEntity.setAddAdvanceEnable(1);
        fieldAttrEntity.setShowAdd(1);
        fieldAttrEntity.setRemove(1);
        fieldAttrEntity.setRemoveAdvanceEnable(1);
        fieldAttrEntity.setShowRemove(1);
        fieldAttrEntity.setSetType(3);
        fieldAttrEntity.setIsForbidden(0);
        fieldAttrEntity.setEditable(1);
        fieldAttrEntity.setUnableEditMemo(null);
        fieldAttrEntity.setAddRule(FormDataFormExplainHelper.getDefaultRule(RoleEnum.MANAGER));
        fieldAttrEntity.setRemoveRule(FormDataFormExplainHelper.getDefaultRule(RoleEnum.MANAGER));
    }
    public static void initOwnerId(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setRequired(0);
        fieldAttrEntity.setMultiple(1);
        fieldAttrEntity.setShowEditable(0);
        //可新增权限：默认【超级管理员、销售主管、创建人、负责人、负责人主管】可新增负责人，支持自定义；
        fieldAttrEntity.setAdd(1);
        fieldAttrEntity.setAddAdvanceEnable(1);
        fieldAttrEntity.setShowAdd(1);
        fieldAttrEntity.setRemove(1);
        fieldAttrEntity.setRemoveAdvanceEnable(1);
        fieldAttrEntity.setShowRemove(1);
        fieldAttrEntity.setSetType(3);
        fieldAttrEntity.setIsForbidden(0);
        fieldAttrEntity.setEditable(1);
        fieldAttrEntity.setUnableEditMemo(null);
        DefaultAttrPoJo defaultAttrPoJo = new DefaultAttrPoJo();
        defaultAttrPoJo.setDefaultType(DefaultTypeEnum.DYNAMIC.getAlias());
        defaultAttrPoJo.setDefaultValue(DefaultValueEnum.LOGIN_USER.getValue());
        fieldAttrEntity.setDefaultAttr(defaultAttrPoJo);
        fieldAttrEntity.setAddRule(FormDataFormExplainHelper.getDefaultRule(RoleEnum.MANAGER));
        fieldAttrEntity.setRemoveRule(FormDataFormExplainHelper.getDefaultRule(RoleEnum.MANAGER));
    }
    public static void initAddTime(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setEditable(0);
        fieldAttrEntity.setUnableEditMemo(I18nMessageUtil.getMessage(StringConstant.AUTO_GEN_FIELD));
    }
    public static void initUpdateTime(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setEditable(0);
        fieldAttrEntity.setUnableEditMemo(I18nMessageUtil.getMessage(StringConstant.AUTO_GEN_FIELD));
    }

    public static void initCreator(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setIsForbidden(0);
        DefaultAttrPoJo defaultAttrPoJo = new DefaultAttrPoJo();
        defaultAttrPoJo.setDefaultType(DefaultTypeEnum.DYNAMIC.getAlias());
        defaultAttrPoJo.setDefaultValue(DefaultValueEnum.LOGIN_USER.getValue());
        fieldAttrEntity.setDefaultAttr(defaultAttrPoJo);
    }

    public static void initScore(FieldAttrEntity fieldAttrEntity) {
        //默认不开启
        fieldAttrEntity.setIsOpen(0);
        //默认精度 设置为 2
        fieldAttrEntity.setAccuracy(2);
        //不开启汇总
        fieldAttrEntity.setSummaryFlag(0);
    }

    /**
     * 初始化应收账期
     */
    public static void initReceivablePeriod(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setIsOpen(0);
        fieldAttrEntity.setIsForbidden(BasicConstant.ZERO);
        fieldAttrEntity.setNoRepeat(0);
        fieldAttrEntity.setMemo(I18nMessageUtil.getMessage(I18nStringConstant.RECEIVABLE_PERIOD));
    }

}
